'''
对要提交的数据做分组排序
'''

import pandas as pd
from math import*
import matplotlib.pyplot as plt
import numpy as np

# 读入数据文件
predict_data = pd.read_csv("data/submit_date.csv")
df_predict_data = pd.DataFrame(predict_data,index=None,columns=['test_id','PM2.5','PM10','O3'])

for index,row in df_predict_data.iterrows():
    value = row['test_id']# = row['test_id']+"#"+str(index)
    num_value = value.split('#')[1]
    prefix_value = value.split('#')[0]
    if len(num_value) == 1:
        result_value = prefix_value + '#0'+str(num_value)
        df_predict_data['test_id'][index] = result_value
df_predict_data = df_predict_data.sort_values(by='test_id')
for index,row in df_predict_data.iterrows():
    #print(index)
    value = row['test_id']
    num_value_str = value.split('#')[1]
    prefix_value = value.split('#')[0]
    if num_value_str[0] == '0':
        df_predict_data['test_id'][index] = prefix_value + '#'+num_value_str[1]

#print(df_predict_data)
df_predict_data.to_csv('output/merge_aq_meo/final_predict_data.csv',index=False)
